<template>
	<view class="WareHouse">
		<template v-for="(item, index) in list">
			<ware-item :item='item' :key='index' :getListData='getListData'></ware-item>
		</template>
		<view class="oprate">
			<view class="create fajc" @click="createWareItem">
				<image class="icon" src="../../static/icon/chuangjianwupin.svg" mode="widthFix"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import WareItem from './WareItem.vue';
	export default {
		components: {
			WareItem
		},
		data() {
			return {
				list: [
					{
						name: 'iukash',
						count: 12312
					},
					{
						name: 'ajsvnmzxask好的',
						count: 1
					},
					{
						name: 'iukash',
						count: 12312
					},
					{
						name: 'iukash',
						count: 12312
					},
					{
						name: 'ajsvnmzxask好的',
						count: 1
					},
					{
						name: 'iukash',
						count: 12312
					},
				]
			}
		},
		onLoad() {
			this.getListData()
		},
		onBackPress(e) {
			uni.redirectTo({
				url: "/pages/index/index"
			})
			return true;
		},
		methods: {
			async getListData() {
				const [err, res] = await uni.request({
					url: this.BASE_URL + '/getWareList',
					method: 'GET'
				})
				console.log(res.data)
				this.list = res.data.data
			},
			createWareItem() {
				uni.navigateTo({
					url: "/pages/WareEdit/WareEdit"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.WareHouse {
		.oprate {
			position: fixed;
			bottom: 0;
			left: 0;
			height: 100rpx;
			width: 100%;
			// border-top: 1px solid #e4e6eb;
			display: flex;
			align-items: center;
			justify-content: flex-end;

			.create {
				margin-top: -100rpx;
				margin-right: 80rpx;
				width: 100rpx;
				height: 100rpx;
				border: 2px solid #e4e6eb;
				border-radius: 50%;
				box-shadow: 0px 3px 5px #e4e6eb;
				
				.icon {
					width: 80rpx;
				}
			}
		}
	}
</style>
